<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath(); //解決跳轉后樣式丟失的問題
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/background/style/resource/Css/bootstrap.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/background/style/resource/Css/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/background/style/resource/Css/style.css" />
<script type="text/javascript"
	src="<%=path%>/background/style/resource/Js/jquery.js"></script>
<script type="text/javascript"
	src="<%=path%>/background/style/resource/Js/jquery.sorted.js"></script>
<script type="text/javascript"
	src="<%=path%>/background/style/resource/Js/bootstrap.js"></script>
<script type="text/javascript"
	src="<%=path%>/background/style/resource/Js/ckform.js"></script>
<script type="text/javascript"
	src="<%=path%>/background/style/resource/Js/common.js"></script>


<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>


<script>
	function editpwd() {
		return ValidateOpwd() && ValidateNpwd();
	}

	
	function  ValidateOpwd(){
	    var pwd = $("#opwd").val();
		$("#omsg").html("");
		var msg = false;
	    $.ajax({
	        type: "POST",
	        cache: false,
	        async: false,
	        data: "pwd=" + pwd,  
	        url: "/tbpoject/business/validatepwd",
	        success: function(data) {
	        	if (data == "0") {
					$("#omsg").html("密码错误！")
				} else {
					msg=true;
				}
	        }
	    });
	    return msg;
	}
	function ValidateNpwd() {
		var pwd = $("#npwd").val();
		var spwd = $("#snpwd").val();
		$("#nmsg").html("");
		if (pwd != spwd) {
			$("#nmsg").html("两次输入的密码不一致!");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
	<form action="/tbpoject/business/updatepwd" method="get"
		class="definewidth m20">
		<table class="table table-bordered table-hover definewidth m10">

			<tr>
				<td width="10%" class="tableleft">旧密码</td>
				<td><input type="password" id="opwd" onblur="ValidateOpwd()" /><span
					id="omsg"></span></td>
			</tr>

			<tr>
				<td class="tableleft">新密码</td>
				<td><input type="password" id="npwd" name="npwd" /></td>
			</tr>
			<tr>
				<td class="tableleft">再次输入</td>
				<td><input type="password" id="snpwd" onblur="ValidateNpwd()" /><span
					id="nmsg"></span></td>

			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button class="btn btn-primary" type="submit"
						onclick="return editpwd()">提交</button> &nbsp;&nbsp;
					<button type="reset" class="btn btn-success" name="backid"
						id="backid">重置</button>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
